package com.example.company.service.impl;


import com.example.company.entity.Positions;
import com.example.company.entity.Users;
import com.example.company.mapper.PositionsMapper;
import com.example.company.service.IPositionsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 存储职位信息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-12-30
 */
@Service
public class PositionsServiceImpl implements IPositionsService {
	@Autowired
	private PositionsMapper positionsMapper;
	
	/**
	 * 查询存储职位信息
	 *
	 * @param PositionID 存储职位信息主键
	 * @return 存储职位信息
	 */
	@Override
	public Positions selectPositionsByPositionID(Long PositionID) {
		return positionsMapper.selectPositionsByPositionID(PositionID);
	}
	
	/**
	 * 查询存储职位信息列表
	 *
	 * @param positions 存储职位信息
	 * @return 存储职位信息
	 */
	@Override
	public List<Positions> selectPositionsList(Positions positions) {
		return positionsMapper.selectPositionsList(positions);
	}
	
	/**
	 * 新增存储职位信息
	 *
	 * @param positions 存储职位信息
	 * @return 结果
	 */
	@Override
	public int insertPositions(Positions positions) {
		return positionsMapper.insertPositions(positions);
	}
	
	/**
	 * 修改存储职位信息
	 *
	 * @param positions 存储职位信息
	 * @return 结果
	 */
	@Override
	public int updatePositions(Positions positions) {
		return positionsMapper.updatePositions(positions);
	}
	
	/**
	 * 批量删除存储职位信息
	 *
	 * @param PositionIDs 需要删除的存储职位信息主键
	 * @return 结果
	 */
	@Override
	public int deletePositionsByPositionIDs(Long[] PositionIDs) {
		return positionsMapper.deletePositionsByPositionIDs(PositionIDs);
	}
	
	/**
	 * 删除存储职位信息信息
	 *
	 * @param PositionID 存储职位信息主键
	 * @return 结果
	 */
	@Override
	public int deletePositionsByPositionID(Long PositionID) {
		return positionsMapper.deletePositionsByPositionID(PositionID);
	}
	
	@Override
	public PageInfo<Positions> findPage(int pageNum, int pageSize, Positions positions) {
		PageHelper.startPage(pageNum, pageSize);
		List<Positions> list =positionsMapper.selectPositionsList(positions);
		
		System.out.println("List size: " + list.size());
		System.out.println("Page size: " + pageSize);
		PageInfo<Positions> info = new PageInfo<>(list);
		return info;
	}
}
